/*
day287
2020.6.10
*/
#include<vector>
#include<cstdlib>
using namespace std;


class Solution {
public:
    int numberOfSubarrays(vector<int>& nums, int k) {
		int *arr=(int *)malloc(sizeof(int) * (nums.size()+1));
		arr[0]=0;
		int res=0;
		
		for(int i=0;i<nums.size();++i)
		{
			if(nums[i]%2==0)
			{
				arr[i+1]=arr[i];
			}
			else
			{
				arr[i+1]=arr[i]+1;
			}
		}
		
		for(int l=0;l<nums.size();++l)
		{
			for(int len=k;l+len<=nums.size();++len)
			{
				int r=l+len;
				if(arr[r]-arr[l]==k)
				{
					res++;
				}
			}
		}
		return res;
    }
};

int main()
{
	return 0;
 } 
